import {TranslateLoader} from "@ngx-translate/core";
import {Observable} from "rxjs";
import {HttpClient} from "@angular/common/http";
import {environment} from '../../../../environments/environment';

export class I18nFilesLoader implements TranslateLoader {
    constructor(private http: HttpClient,
                public prefix: string = environment.baseHref + "/assets/i18n/",
                public suffix: string = ".json") {
    }

    getTranslation(lang: string): Observable<any> {
      return this.http.get<any>(`${this.prefix}${lang}${this.suffix}?v=${new Date().getTime()}`);
    }
}
